// components/searchPicker/searchPicker.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    value:{
      type: String,
      value: ''
    },
    range:{
      type: Array,
      value: []
    },
    placeholder:{
      type: String,
      value: ''
    },
    leftValue:{
      type: String,
      value: ''
    },
    rightValue: {
      type: String,
      value: ''
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    showPanle:false
  },

  /**
   * 组件的方法列表
   */
  methods: {
    pandleHandle(e){
      let self= this;
      console.log(e)
      let type = e.currentTarget.dataset.type;
      switch (type){
        case 'show':
          self.data.showPanle= true;
          self.triggerEvent('getSearchAll', self.data.value)
        break;
        case 'hidden':
          self.data.showPanle = false;
          let value = e.currentTarget.dataset.value;
          self.triggerEvent('selectItem', value) 
        break;
      }
      self.setData({
        showPanle: self.data.showPanle
      })
    },
    bindinput(e){
      this.data.showPanle = true;
      this.setData({
        showPanle: this.data.showPanle
      })
      this.triggerEvent('getSearchAll', e.detail.value);
    }
  }
})
